package cn.controller.product;

import cn.service.productService.ProductServiceImpl.CategoryServiceImpl;
import entity.productEntity.Category;
import entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 朱颢阳
 * @description
 * @time 2024/8/21 20:29
 */
@RestController
@CrossOrigin
@RequestMapping("/product")
public class CategoryController {
    @Autowired
    CategoryServiceImpl service;
    @RequestMapping("/selectCategoryAll")
    public Result selectCategoryAll(Integer parent_id,Integer currentPage, Integer pageSize){
        return service.selsectAll(parent_id,currentPage,pageSize);
    }
    @RequestMapping("/insertCategory")
    public Result insertCategory(@RequestBody Category attribute){
        return service.insertCategory(attribute);
    }
    @RequestMapping("/updataCategory")
    public Result updataCategory(@RequestBody Category attribute){
        return service.updataCategory(attribute);
    }
    @RequestMapping("/deleteCategory")
    public Result deleteCategory(Integer id){
        return service.deleteCategory(id);
    }
    @RequestMapping("/selectparents")
    public Result selectparents(){
        return service.selectparents();
    }
    @RequestMapping("/getoptions")
    public Result getoptions(){
        return service.getoptions();
    }
}
